package com.oa.xinxi.dao;

import com.oa.xinxi.entity.MSGManager;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface MSGManagerMapper {
    @Delete({
        "delete from xx_gl",
        "where xxgl_id = #{xxglId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer xxglId);

    @Insert({
        "insert into xx_gl (xxgl_id, send_user_id, ",
        "receive_user_id, title, ",
        "type, read_or_not, ",
        "open_or_not, js_time, ",
        "fs_time, content)",
        "values (#{xxglId,jdbcType=INTEGER}, #{sendUserId,jdbcType=INTEGER}, ",
        "#{receiveUserId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=VARCHAR}, #{readOrNot,jdbcType=VARCHAR}, ",
        "#{openOrNot,jdbcType=VARCHAR}, #{jsTime,jdbcType=VARCHAR}, ",
        "#{fsTime,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})"
    })
    int insert(MSGManager record);

    @InsertProvider(type=MSGManagerSqlProvider.class, method="insertSelective")
    int insertSelective(MSGManager record);

    @Select({
        "select",
        "xxgl_id, send_user_id, receive_user_id, title, type, read_or_not, open_or_not, ",
        "js_time, fs_time, content",
        "from xx_gl",
        "where xxgl_id = #{xxglId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="xxgl_id", property="xxglId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="send_user_id", property="sendUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="receive_user_id", property="receiveUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="read_or_not", property="readOrNot", jdbcType=JdbcType.VARCHAR),
        @Result(column="open_or_not", property="openOrNot", jdbcType=JdbcType.VARCHAR),
        @Result(column="js_time", property="jsTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="fs_time", property="fsTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    MSGManager selectByPrimaryKey(Integer xxglId);

    @UpdateProvider(type=MSGManagerSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(MSGManager record);

    @Update({
        "update xx_gl",
        "set send_user_id = #{sendUserId,jdbcType=INTEGER},",
          "receive_user_id = #{receiveUserId,jdbcType=INTEGER},",
          "title = #{title,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "read_or_not = #{readOrNot,jdbcType=VARCHAR},",
          "open_or_not = #{openOrNot,jdbcType=VARCHAR},",
          "js_time = #{jsTime,jdbcType=VARCHAR},",
          "fs_time = #{fsTime,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where xxgl_id = #{xxglId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(MSGManager record);

    @Update({
        "update xx_gl",
        "set send_user_id = #{sendUserId,jdbcType=INTEGER},",
          "receive_user_id = #{receiveUserId,jdbcType=INTEGER},",
          "title = #{title,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "read_or_not = #{readOrNot,jdbcType=VARCHAR},",
          "open_or_not = #{openOrNot,jdbcType=VARCHAR},",
          "js_time = #{jsTime,jdbcType=VARCHAR},",
          "fs_time = #{fsTime,jdbcType=VARCHAR}",
        "where xxgl_id = #{xxglId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(MSGManager record);
}